<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

//use Yii;
use yii\helpers\Html;
//use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
use frontend\controllers\ListController;
use backend\controllers\CategoryController;
use common\models\category\Category;
use common\models\fenhuigrade\Fenhuigrade;
use common\models\setting\Setting;
use common\models\Ad\AdPosition;
use common\models\Ad\Ad;


?>
<?php
$data = Category::find()->where(['status' => 1, 'parent_id' => 0])->asArray()->all();
$cats = Category::catlist();
$guanggao = Ad::find()->where(['position_id'=>6])->asArray()->all();//首页banner广告位
$morenguang = Ad::find()->where(['position_id'=>9])->one();//首页banner默认广告位
$fg = Fenhuigrade::find()->where(['status' => 10])->asArray()->all();
//网站logo
$imgLOGO = '';
try { $imgLOGO = Setting::findOne(['code'=>'imgLOGO'])->value;}
catch(ErrorException $e){ }
//网站名称
$name = '';
try
{ $name = Setting::findOne(['code'=>'siteName'])->value;}
catch(ErrorException $e) { }
?>
<?php 
$data = Category::find()->where(['status' => 1, 'parent_id' => 0])->asArray()->all();
$cats = Category::catlist();
$fenhuio = Fenhuigrade::find()->where(['status'=>10])->one();
?>

<div class="header clearFloat">
    <!--header-->
    <div class="header clearFloat">
        <!--header-top-->
        <div class="header-top">
            <div class="w1113 clearFloat">
                <div class="pl10 pr10 pt13 pb13 clearFloat">
                    <div class="header-topleft floatLeft">
                        <?= date('Y年m月d日',time());?> &nbsp;&nbsp;&nbsp;&nbsp; 欢迎您来到<?=$name;?>
                    </div>
                    <div class="header-topright floatRight">
                        <a href="#" class="topicon relative" title="手机版"><img src="<?= yii::getAlias('@web');?>/images/topicon1.png" title="手机版"><div class="sjfwm"><img src="<?= yii::getAlias('@web');?>/images/fdwx.png" width="172" height="172" alt=""></div></a>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="#" class="topwx relative" title="官方微信公众号"><img src="<?= yii::getAlias('@web');?>/images/topicon2.png" alt=""><div class="wxgwfwx"><img src="<?= yii::getAlias('@web');?>/images/fdwx.png" width="172" height="172" alt=""></div></a>&nbsp;&nbsp;&nbsp;|
                        <!--中英文切换-->
                        <div class="henav floatRight">
                            <p ><a href="http://fsxh.zhongkefu.com.cn">CN</a></p>
<!--                            <ul class="henew">-->
<!--                                <li>Ch</li>-->
<!--                                <li>En</li>-->
<!--                            </ul>-->
                        </div>
                        <!--中英文切换 end-->
                    </div>
                </div>

            </div>
        </div>
        <!--header-top end-->
        <!--header-cont-->
        <div class="header-cont">
            <div class="w1113 clearFloat pt15 pb15">
                <div class="logo floatLeft">
                    <a href="<?= yii\helpers\Url::to(['/']);?>"><img src="/upload/<?= $imgLOGO;?>" alt="网站logo" width="263" height="65"></a>
                </div>
                <div class="header-contright floatRight clearFloat">
                    <form class="registerform" action="<?= yii\helpers\Url::to(['search/search']);?>" enctype="multipart/form-data" id="subform" method='get'>
                        <input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
                        <form class="registerform" action="<?= yii\helpers\Url::to(['search/search']);?>" enctype="multipart/form-data" id="subform" method='get'>
                            <input type="text" name="keywords" placeholder="Enter Key Words" class="hsinput">
                            <a href="" class="seica"><input type="submit" value="" class="seicon"></a>
                        </form>
                    </form>
                    <div class="hexq floatRight clearFloat">
                        <span class="hexspan floatLeft">
                            <a href="/auth/signup/">会员申请</a>&nbsp; | &nbsp;<a href="<?= yii\helpers\Url::to(['member/applyone','id'=>$fenhuio['id']]);?>">申请入会</a>
                        </span>


                    </div>
                </div>
            </div>
        </div>
        <!--header-cont end-->
    </div>
    <!--header end-->
    <!--nav-->
    <div class="nav">
        <div class="w1113">
            <ul class="navul clearFloat">
                <?php foreach($cats as $key=>$ca){ $newurl = '/'.$ca['type']; ?>
                    <li class="nalii">
                        <?php if(!empty($ca['url'])){ ?>
                            <a class="nalia" <?php if(($key+1) %6 ==0){ ?> style="border-right:none!important" <?php } ?> href="<?= $ca['url']; ?>"><?=$ca['name']; ?></a>
                        <?php }else{
                            ?>
                            <a class="nalia" <?php if(($key+1) %6 ==0){ ?> style="border-right:none!important" <?php } ?> href="<?= yii\helpers\Url::to([$ca['type'], 'id' => $ca['id']]); ?>"><?=$ca['name']; ?></a>
                        <?php  } ?>
                        <?php if(!empty($ca['zlm'])){ ?>
                            <div class="navtwo">
                                <ul>
                                    <?php foreach($ca['zlm'] as $caz){ $newurls = '/'.$caz['type'];?>
                                        <li><?php if(!empty($caz['url'])){ ?>
                                                <a href="<?= $caz['url']; ?>"><?=$caz['name']; ?></a>
                                            <?php }else{
                                                ?>
                                            <a href="<?= yii\helpers\Url::to([$newurls, 'id' => $caz['id']]); ?>"><?=$caz['name']; ?></a>
                                            <?php } ?>
                                        </li>
                                    <?php } ?>
                                </ul>
                            </div>
                        <?php }else if ($ca['name'] == '分支机构'){ ?>
                            <div class="navtwo">
                                <ul>
                                    <?php foreach($fg as $gr){ ?>
                                        <li>
                                            <a href="<?= yii\helpers\Url::to(['fenhui/list', 'id' => $gr['id']]); ?>"><?=$gr['name']; ?></a>
                                        </li>
                                    <?php } ?>
                                </ul>
                            </div>
                        <?php } ?>
                    </li>
                <?php } ?>
            </ul>
        </div>
    </div>
<script>
$(document).ready(function() {
    
	$(".nalii").hover(function(){
		  $(this).prev(".nalii").children(".nalia").css("border-right","1px solid #c40400")
		})
	
	$(".nalii").mouseleave(function(){
		if($(this).index()==6){
			$(this).prev(".nalii").children(".nalia").css("border-right","1px solid #c40400")
			}else{
		  $(this).prev(".nalii").children(".nalia").css("border-right","1px solid #891518")}
		})
  
});
</script>
